<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<f:view xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:util="http://java.sun.com/jsf/composite/util">
	<ui:composition template="/views/layouts/main.xhtml">
	<ui:define name="content">
		<h:form id="formPrincipal">
			<div class="grid_18">
				<div class="grid_7">
					<util:home action="#{artefatoBean.goHome}" />
					<p:commandButton value="#{i18n.btn_Salvar}" action="#{artefatoBean.salvarArtefato}" 
						icon="ui-icon ui-icon-disk" ajax="false" onstart="spinner.show();" />
					<p:commandButton value="#{i18n.btn_Desistir}" action="#{artefatoBean.goCancel}" 
						icon="ui-icon ui-icon-cancel" ajax="false" onstart="spinner.show();" immediate="true" />
				</div>
				<util:titulo grid="10" value="#{i18n.Artefato_Titulo}" />
				<div class="grid_1">
					<util:help />
				</div>
			</div>
			
			<div class="grid_18">
				<p:messages closable="true" />
			</div>
			
			<util:label grid="12" value="#{i18n.Artefato_Nome}" />
			<util:label grid="6" value="#{i18n.Artefato_DataHoraCriacao}" />
			<div class="grid_12">
				<p:inputText value="#{artefatoBean.artefatoInstance.nome}" styleClass="width_11" 
					required="true" requiredMessage="#{i18n.Artefato_Required_Nome}" />
			</div>
			<div class="6">
				<p:inputText value="#{artefatoBean.artefatoInstance.dataHoraCriacao}" 
					disabled="true" styleClass="width_6">
					<f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss" />
				</p:inputText>
			</div>
			
			<util:label grid="9" value="#{i18n.Artefato_Projeto}" />
			<util:label grid="9" value="#{i18n.Artefato_ResponsavelCriacao}" />
			<div class="grid_9">
				<p:inputText value="#{artefatoBean.artefatoInstance.projeto.nome}" 
					disabled="true" styleClass="width_8" id="projeto" />
				<p:commandButton icon="ui-icon ui-icon-search" type="button"
					onclick="dialogoBuscaProjeto.show();" style="margin-top: -2px;margin-left: 3px;" />
			</div>
			<div class="grid_9">
				<p:inputText value="#{artefatoBean.artefatoInstance.responsavel.nomeCompleto}" 
					disabled="true" styleClass="width_9" />
			</div>
			
			<util:label grid="18" value="#{i18n.Artefato_Descricao}" />
			<div class="grid_18">
				<p:inputTextarea value="#{artefatoBean.artefatoInstance.descricao}" 
					styleClass="width_18" rows="5" autoResize="true" />
			</div>
			
			<div class="grid_18">
				<br/>
				<p:dataTable id="dataTableAnexos" widgetVar="dataTableAnexos" value="#{artefatoBean.artefatoInstance.anexos}"
					var="model" paginator="true" lazy="true" dynamic="true" 
					paginatorPosition="#{contextoBean.paginatorPosition}" 
					rows="#{contextoBean.dataTableRows}" paginatorTemplate="#{contextoBean.paginatorTemplate}"
					selection="#{atorBean.atorSelect}" rowsPerPageTemplate="#{contextoBean.rowsPerPage}">
					<f:facet name="header">
						<div class="grid_7 tituloDataTable">
							<h:outputText value="#{i18n.Artefato_GridAnexo_Titulo}" />
						</div>
					</f:facet>
					<p:column headerText="#{i18n.Artefato_GridAnexo_Nome}">
						<h:outputText value="#{model.nome}" />
					</p:column>
					<p:column headerText="#{i18n.Artefato_GridAnexo_Tamanho}" 
						style="width:50px">
						<h:outputText value="#{model.tamanho}" />
					</p:column>
				</p:dataTable>
			</div>
			
			<div class="grid_18">
				<br/>
				<p:dataTable id="dataTableDocumentos" widgetVar="dataTableDocumentos" value="#{artefatoBean.artefatoInstance.documentos}"
					var="model" paginator="true" lazy="true" dynamic="true" 
					paginatorPosition="#{contextoBean.paginatorPosition}" 
					rows="#{contextoBean.dataTableRows}" paginatorTemplate="#{contextoBean.paginatorTemplate}"
					selection="#{atorBean.atorSelect}" rowsPerPageTemplate="#{contextoBean.rowsPerPage}">
					<f:facet name="header">
						<div class="grid_7 tituloDataTable">
							<h:outputText value="#{i18n.Artefato_GridDocumento_Titulo}" />
						</div>
					</f:facet>
					<p:column headerText="#{i18n.Artefato_GridDocumento_Nome}" >
						<h:outputText value="#{model.nome}" />
					</p:column>
				</p:dataTable>
			</div>
			
		</h:form>
		
		<ui:include src="/views/artefato/_dialogoBuscaProjeto.xhtml" />
		
	</ui:define>
	</ui:composition>
</f:view>